package com.itheima.reggie.service.impl;

import com.itheima.reggie.common.FrameSpringBeanUtil;
import com.itheima.reggie.controller.DishController;
import com.itheima.reggie.entity.Dish;
import com.itheima.reggie.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;



public class DishThread extends Thread {
    @Autowired
    private DishService service;


    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
         DishServiceimpl bean = FrameSpringBeanUtil.getBean(DishServiceimpl.class);
//        service.selectID(1413342036832100354L);
        bean.selectID(1413342036832100354L);
        System.out.println(Thread.currentThread().getName()+"你好");
    }
}
